package com.kaia.shoebox.activity;

import java.text.SimpleDateFormat;
import java.util.Date;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import com.kaia.shoebox.R;

public class ShowTodoActivity extends Activity {
	
	private static final String TAG = ShowTodoActivity.class.getSimpleName();

	// ------------------------------------------------------------------
	// Attributes
	// ------------------------------------------------------------------

	private TextView mTodoTitle;
	private TextView mDueDateText;
	private TextView mCompletedDateText;
	private TextView mAdditionalStuff;
	private TextView mImportance;

	// ------------------------------------------------------------------
	// System Methods
	// ------------------------------------------------------------------

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.show_todo);

		Intent data = getIntent();
		final String title = data.getStringExtra("title");
		final long due = data.getLongExtra("due", 0);
		final String notes = data.getStringExtra("notes");
		final int imp = data.getIntExtra("importance", 0);
		final long completed = data.getLongExtra("completed", 0);

		Date dueDate = new Date(due);
		Date completedDate = new Date(completed);

		SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm");

		mTodoTitle = (TextView) findViewById(R.id.show_todo_title);
		mTodoTitle.setText(title);

		mDueDateText = (TextView) findViewById(R.id.show_todo_due_date);
		mDueDateText.setText(sdf.format(dueDate));

		mCompletedDateText = (TextView) findViewById(R.id.show_todo_completed_date);
		mCompletedDateText.setText(sdf.format(completedDate));

		mAdditionalStuff = (TextView) findViewById(R.id.show_todo_extra_info);
		mAdditionalStuff.setText(notes);

		String importances[] = getResources().getStringArray(
				R.array.importance_spinner);

		mImportance = (TextView) findViewById(R.id.show_todo_importance);
		mImportance.setText(importances[imp]);
	}
}
